import request from "@/utils/request";

// 查询所有学生
export function queryPageApi(name, degree, clazzId, page, pageSize) {
  return request({
    url: "/students",
    method: "get",
    params: {
      name,
      degree,
      clazzId,
      page,
      pageSize,
    },
  });
}

// 根据 ID 查询单个学生
export function queryInfoApi(id) {
  return request({
    url: `/students/${id}`,
    method: "get",
  });
}

// 新增学生
export function addStudentApi(data) {
  return request({
    url: "/students",
    method: "post",
    data,
  });
}

// 更新学生
export function updateStudentApi(data) {
  return request({
    url: `/students`,
    method: "put",
    data,
  });
}

// 删除学生
export function deleteStudentApi(ids) {
  return request({
    url: `/students/${ids}`,
    method: "delete",
  });
}

//违纪处理 put
export function handleDisciplineApi(id, score) {
  return request({
    url: `/students/violation/${id}/${score}`,
    method: "put",
    data: { id, score },
  });
}
